<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page session="true"%>
<%@ page import="javax.portlet.*"%>
<%@page import ="rai.dto.*" %>
<%@page import ="rai.dao.*" %>
<%@page import = "java.util.*" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>


<portlet:defineObjects />
<html xmlns="http://www.w3.org/1999/xhtml">

<script type="text/javascript">
	function getForm(namespace, name) {
		return document.forms[namespace + name];
	}

	function back_to_empInfo(namespace, name) {
		var frm = getForm(namespace, name);
		clrallcookie();
		//Missing set all attribute -> ""
		frm.txtAction.value = "back_to_empInfo_form_1";
		frm.submit();
	}
	function back_to_login(namespace, name) {
		var frm = getForm(namespace, name);
		clrallcookie();
		frm.txtAction.value = "back_to_login_form";
		frm.submit();
	}
	function edit_profile(namespace, name){
		var frm = getForm(namespace , name);
		frm.txtAction.value = "edit_profile";
		frm.submit();
	}
	function gotoempinfo(namespace,name,id){
		var frm = getForm(namespace, name);
		frm.txtAction.value = "go_to_empInfo";
		//alert(id);
		frm.txtEmpID.value=id;
		frm.submit();
	}
	function Search(namespace,name){
		var frm= getForm(namespace,name);
		frm.txtAction.value="do_search";
		frm.txtLanghid.value=getValuelst(frm.txtLang.name);
		frm.txtApphid.value=getValuelst(frm.txtApp.name);
		frm.txtTechhid.value=getValuelst(frm.txtTech.name);
		frm.txtFrwhid.value=getValuelst(frm.txtFrw.name);
		var div = document.getElementById('lstDept');
		setCookie('lstDept',div.innerHTML,1);
		setCookie('lstDeptvalue',frm.lstDept.value,1);
		div = document.getElementById('lstDeptIssued');
		setCookie('lstDeptIssued',div.innerHTML,1);
		setCookie('lstDeptIssuedvalue',frm.lstDeptIssued.value,1);
		div = document.getElementById('lstCourse');
		setCookie('lstCourse',div.innerHTML,1);
		setCookie('lstCoursevalue',frm.lstCourse.value,1);
		div = document.getElementById('lstPrjDept');
		setCookie('lstPrjDept',div.innerHTML,1);
		setCookie('lstPrjDeptvalue',frm.lstPrjDept.value,1);
		div = document.getElementById('lstPrj');
		setCookie('lstPrj',div.innerHTML,1);
		setCookie('lstPrjvalue',frm.lstPrj.value,1);
		div = document.getElementsByName('txtLang')[0];
		setCookie('txtLang',div.innerHTML,1);
		div = document.getElementsByName('txtApp')[0];
		setCookie('txtApp',div.innerHTML,1);
		div = document.getElementsByName('txtTech')[0];
		setCookie('txtTech',div.innerHTML,1);
		div = document.getElementsByName('txtFrw')[0];
		setCookie('txtFrw',div.innerHTML,1);
		
		frm.submit();
	}
	
	function getValuelst(name){
		var lst=document.getElementsByName(name)[0];
		//alert(name+lst.options.length);
		var string="";
		for(i=0;i<lst.options.length;i++)
		{
			if(string==""){
				string = lst.options[i].value;
			}else{
				string = string+';'+lst.options[i].value;
			}
			//alert(string);
		}
		return string;
	}
	function removelist(lst){
		var elSel=document.getElementsByName(lst)[0];
		elSel.remove(elSel.selectedIndex);
		
	}
	
	function outputtolist(lst,txtExp,txt){
		var lstFrw=document.getElementsByName(lst)[0];
		var txtExpFrw=document.getElementsByName(txtExp)[0];
		var txtFrw=document.getElementsByName(txt)[0];
		
		//alert(lst);
		if(txtExpFrw.value!=''){
			if(!isNaN(txtExpFrw.value)){
	  			if(txtFrw.options.length==0){
		  				value = lstFrw.value+'|'+txtExpFrw.value;
		  				
						txtFrw.options[0]= new Option(lstFrw.options[lstFrw.selectedIndex].text+' '+txtExpFrw.value+' (months)',value,true,false);
						
						
	  			}else
	  			{
	  				var temp = new Array();
	  				check= false;
	  				//alert('dzo');
	  				for(i=0;i<(txtFrw.options.length);i++)
	  				{
	  					
	  					temp= txtFrw.options[i].value.split("|");
	  					
	  					if(temp[0]==lstFrw.value)
	  					{
	  	  					
	  						month = parseInt(txtExpFrw.value);
	  						//alert(month);
	  						txtFrw.options[i].text= lstFrw.options[lstFrw.selectedIndex].text+' '+month+' (months)';
	  						txtFrw.options[i].value= temp[0]+'|'+month;
	  						check= true;
	  					}
	  				}
	  				if(!check){
		  				
		  				txtFrw.options[txtFrw.options.length]=new Option(lstFrw.options[lstFrw.selectedIndex].text+' '+txtExpFrw.value+' (months)',lstFrw.value+'|'+txtExpFrw.value,true,false);
		  				
		  				
		  			}
	  			}
	  		}else{
	  			alert('Months of Experience must be a number!!!');
			}
		}else{
			alert('Months of Experience must be a number!!!');
		}
		
	}
	function getCompName(namespace, name){
		
		var frm = getForm(namespace, name);
		frm.submit();
	}
	function asynchGet(updateURL,lstresponse){
		 
	    if (window.XMLHttpRequest) {
	        portletReq = new XMLHttpRequest();
	    } else if (window.ActiveXObject) {
	        portletReq = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  // alert(updateURL+" "+ lstresponse);
	    portletReq.onreadystatechange = function() {processReqChange(lstresponse);};
	    
	    portletReq.open("GET", updateURL, true);
	    //alert(updateURL);
	    portletReq.send(null);
	}
	function processReqChange(lstresponse) {
		//alert(portletReq.status+" "+portletReq.readyState);
		//alert(lstresponse);
	    if (portletReq.readyState == 4) {
	        if (portletReq.status == 200) {
	            // process response
	            //alert("proccess");
	            displayDepartment(lstresponse);
	        }
	    }
	}
	function selectComp(evt,lstresponse) {
		
	    evt = (evt) ? evt : ((window.event) ? window.event : null);
	    if (evt) {
	    	
	        var select = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	        if (select && select.options.length > 1) {
	        	 //alert(lstresponse);
	           asynchGet('<%=request.getContextPath()%>'+"/SearchInfoServlet?lstComp=" + select.value+"&name="+lstresponse,lstresponse);
	        }
	    }
	}
		
	function displayDepartment(lstresponse) {
	    // substitute new invoice HTML content into "portletcontent" <div> tag
	    //alert(lstid);
	   // alert(lstresponse);
	    //alert("result"+portletReq.responseText);
	    var div = document.getElementById(lstresponse);
	    
	    div.innerHTML = "";
	   
	    
	    div.innerHTML = portletReq.responseText;
	}
	function search_Reload(namespace,name){
		var frm = getForm(namespace, name);
		clrallcookie();
		//alert("reset");
		//Missing set all attribute -> ""
		frm.txtAction.value = "reload_Search";
		frm.submit();
	}
	function clrallcookie(){
		if(document.cookie){
			clearCookie('lstDept');
			clearCookie('lstDeptvalue');
			clearCookie('lstDeptIssued');
			clearCookie('lstDeptIssuedvalue');
			clearCookie('lstCourse');
			clearCookie('lstCoursevalue');
			clearCookie('lstPrjDept');
			clearCookie('lstPrjDeptvalue');
			clearCookie('lstPrj');
			clearCookie('lstPrjvalue');
			clearCookie('txtLang');
			clearCookie('txtApp');
			clearCookie('txtTech');
			clearCookie('txtFrw');
		}
	}
	
	function setCookie(c_name,value,expiredays) {
	    var exdate=new Date();
	    exdate.setDate(exdate.getDate()+expiredays);
	    document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	}
	function getCookie(c_name) {
	    if (document.cookie.length>0) {
	        c_start=document.cookie.indexOf(c_name + "=");
	        if (c_start!=-1) { 
	            c_start=c_start + c_name.length+1; 
	            c_end=document.cookie.indexOf(";",c_start);
	            if (c_end==-1) c_end=document.cookie.length;
	            var cookieContent = unescape(document.cookie.substring(c_start,c_end));
	            return cookieContent;
	        } 
	    }
	}
	function clearCookie(Name){
	    var new_date = new Date();
	    new_date.setTime(new_date.getTime()-1);
	   	document.cookie=Name+'=;expires='+new_date.toGMTString();
	}
	
		
	function initData(){
		var div = document.getElementById("lstDept");
		if(document.cookie){
			var str=getCookie('lstDept');
			var value=getCookie('lstDeptvalue');
			if(value!=null&&str!=null){
				div.innerHTML=str;
				div=document.getElementsByName("lstDept")[0];
				div.value=value;
			}
			else{
				div.innerHTML = "<select name=\"lstDept\" disabled > <option value=\"0\">All</option> </select>";
			}
			
		div = document.getElementById("lstDeptIssued");
		str=getCookie('lstDeptIssued');
		value=getCookie('lstDeptIssuedvalue');
		if(value!=null&&str!=null){
			div.innerHTML=str;
			div=document.getElementsByName("lstDeptIssued")[0];
			div.value=value;
		}
		else{
			div.innerHTML = "<select name=\"lstDeptIssued\" disabled > <option value=\"0\">All</option> </select>";
		}
		div = document.getElementById("lstCourse");
		str=getCookie('lstCourse');
		value=getCookie('lstCoursevalue');
		if(value!=null&&str!=null){
			div.innerHTML=str;
			div=document.getElementsByName("lstCourse")[0];
			div.value=value;
		}
		else{
			div.innerHTML = "<select name=\"lstCourse\" disabled > <option value=\"0\">All</option> </select>";
		}
		
		div = document.getElementById("lstPrjDept");
		str=getCookie('lstPrjDept');
		value=getCookie('lstPrjDeptvalue');
		if(value!=null&&str!=null){
			div.innerHTML=str;
			div=document.getElementsByName("lstPrjDept")[0];
			div.value=value;
		}
		else{
			div.innerHTML = "<select name=\"lstPrjDept\" disabled > <option value=\"0\">All</option> </select>";
		}
		div = document.getElementById("lstPrj");
		str=getCookie('lstPrj');
		value=getCookie('lstPrjvalue');
		if(value!=null&&str!=null){
			div.innerHTML=str;
			div=document.getElementsByName("lstPrj")[0];
			div.value=value;
		}
		else{
			div.innerHTML = "<select name=\"lstPrj\" disabled > <option value=\"0\">All</option> </select>";
		}
		div = document.getElementsByName('txtLang')[0];
		str=getCookie('txtLang');
		div.innerHTML=str;
		div = document.getElementsByName('txtApp')[0];
		str=getCookie('txtApp');
		div.innerHTML=str;
		div = document.getElementsByName('txtTech')[0];
		str=getCookie('txtTech');
		div.innerHTML=str;
		div = document.getElementsByName('txtFrw')[0];
		str=getCookie('txtFrw');
		div.innerHTML=str;
	}else{
		div = document.getElementById('lstDept');
		div.innerHTML = "<select name=\"lstDept\" disabled > <option value=\"0\">All</option> </select>";
		div = document.getElementById("lstDeptIssued");
		div.innerHTML = "<select name=\"lstDeptIssued\" disabled > <option value=\"0\">All</option> </select>";
		div = document.getElementById("lstCourse");
		div.innerHTML = "<select name=\"lstCourse\" disabled > <option value=\"0\">All</option> </select>";
		div = document.getElementById("lstPrjDept");
		div.innerHTML = "<select name=\"lstPrjDept\" disabled > <option value=\"0\">All</option> </select>";
		div = document.getElementById("lstPrj");
		div.innerHTML = "<select name=\"lstPrj\" disabled > <option value=\"0\">All</option> </select>";
	}
	}
function updateCourse(evt) {
	//alert("update");
	    evt = (evt) ? evt : ((window.event) ? window.event : null);
	    if (evt) {
	    	
	        var select = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
	        if (select && select.options.length > 1) {
	        	 //alert("update");
	        	 if(select.name =='lstDeptIssued'){
	          		 asynchGetcourse('<%=request.getContextPath()%>'+"/SearchInfoServlet?lstDept=" + select.value);
	        	 }
	        	 else if(select.name == 'lstPrjDept'){
	        		 asynchGetprj('<%=request.getContextPath()%>'+"/SearchInfoServlet?lstPrjDept=" + select.value);
	        	 }
	        }
	    }
	}
function asynchGetcourse(updateURL){
	//alert(updateURL+" ");
    if (window.XMLHttpRequest) {
        portletReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        portletReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
   //alert(updateURL+" ");
    portletReq.onreadystatechange = processReqChangeCourse;
    
    portletReq.open("GET", updateURL, true);
    //alert(updateURL);
    portletReq.send(null);
}
function processReqChangeCourse() {
	//alert(portletReq.status+" "+portletReq.readyState);
	//alert(lstresponse);
    if (portletReq.readyState == 4) {
        if (portletReq.status == 200) {
            // process response
           // alert("proccess");
            displayCourse();
        }
    }
}
function displayCourse() {
    // substitute new invoice HTML content into "portletcontent" <div> tag
    //alert(lstid);
    //alert(lstresponse);
    var div = document.getElementById("lstCourse");
    div.innerHTML = "";
   // alert("result"+portletReq.responseText);
    div.innerHTML = portletReq.responseText;
}

function asynchGetprj(updateURL){
	//alert(updateURL+" ");
    if (window.XMLHttpRequest) {
        portletReq = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        portletReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
   //alert(updateURL+" ");
    portletReq.onreadystatechange = processReqChangePrj;
    
    portletReq.open("GET", updateURL, true);
    //alert(updateURL);
    portletReq.send(null);
}
function processReqChangePrj() {
	//alert(portletReq.status+" "+portletReq.readyState);
	//alert(lstresponse);
    if (portletReq.readyState == 4) {
        if (portletReq.status == 200) {
            // process response
           // alert("proccess");
            displayPrj();
        }
    }
}
function displayPrj() {
    // substitute new invoice HTML content into "portletcontent" <div> tag
    //alert(lstid);
    //alert(lstresponse);
    var div = document.getElementById("lstPrj");
    div.innerHTML = "";
    //alert("result"+portletReq.responseText);
    div.innerHTML = portletReq.responseText;
}
var cP=1;
function changePage(pagenum){
	var divshow=document.getElementById(cP);
	var div=document.getElementById(pagenum);
	divshow.style.display='none';
	div.style.display='';
	//alert(div.innerHTML);
	
	cP=pagenum;
}

function ExporttoExcel(namespace,name)
{
	var frm= getForm(namespace,name);
	frm.txtAction.value="export_all";
	frm.submit();
}


</script>

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Personal Information Tracking System</title>
<meta name="keywords" content="" />
<meta name="description" content="" />

<script type="text/javascript" src="simpletreemenu.js">
/***********************************************
* Simple Tree Menu- Â© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<link rel="stylesheet" type="text/css" href="style/simpletree.css" />

<script type="text/javascript" src="calendarDateInput.js">

/***********************************************
* Jason's Date Input Calendar- By Jason Moon http://calendar.moonscript.com/dateinput.cfm
* Script featured on and available at http://www.dynamicdrive.com
* Keep this notice intact for use.
***********************************************/

</script>

<link href='<%=request.getContextPath()+"css/style.css"%>' rel="stylesheet" type="text/css" media="screen" /></head>

<body  onload="initData()">
<form name="<portlet:namespace/>searchInfoForm" action="<portlet:actionURL/>" method="POST">
<input type="hidden" name="txtAction" />
<input type="hidden" name="txtLanghid" />
<input type="hidden" name="txtApphid" />
<input type="hidden" name="txtTechhid" />
<input type="hidden" name="txtFrwhid" />
<input type="hidden" name="txtEmpID" />
<table align="center">
	<tr class="title">
			<td>		
					<h1><font color="blue">Personal information tracking system</font></h1>
					<p>Exploit the value of data</p>
					<hr />
			</td>
	</tr>
	 <tr>
					<td colspan="2" align="left"> Welcome, <font color="orange"/><b>[${sessionScope.role}]${sessionScope.name}</b></font>
					| <a href="#" onclick="back_to_empInfo('<portlet:namespace/>','searchInfoForm')">Home</a> 
					| <a href="#" onclick="edit_profile('<portlet:namespace/>','searchInfoForm')">Edit Profile</a>
					| <a href="#" onclick="back_to_login('<portlet:namespace/>','searchInfoForm')">Logout</a>
				   </td>
	</tr>
	<tr>	
	<tr>
		<td style="vertical-align:text-top">
            <table border="1">
                <tr>
                	<td>
			<table border="1">
				<tr>
					<td><h2 class="title">Search Employee Information</h2></td>
				</tr>
				 
				<tr>
					<td>
						<table border="1" width="100%">							
							<tr>
							  <td align="left" valign="bottom">&nbsp;Employee Name&nbsp;</td>
							  <td align="left" valign="middle" colspan="3"><input type="text" name="txtEmpName" /></td>							  							 						  </tr>
							<tr>
							  <td align="left" valign="bottom">&nbsp;Company&nbsp;</td>
							  <td align="left" valign="middle"><select name="lstComp" onchange="selectComp(event,'lstDept')">
							  <%---<%String SelectData=session.getAttribute("lstComp"); --%>
							   
						    <%--<% PortletSession session= request.getSession(true); --%>
						    <% String Compid = (String)session.getAttribute("lstCompID"); %>
							<% List<CompanyDTO> List_comp = new ArrayList<CompanyDTO>(); %>
							<% List_comp= (List<CompanyDTO>)session.getAttribute("CompanyList"); %>
							<% for (int i = 0; i < List_comp.size(); i++){
							CompanyDTO exp = new CompanyDTO();
							exp = List_comp.get(i); 
								if(exp.getId()==Integer.parseInt(Compid)){%>								
							  <option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
							  <%}else{ %>
							  <option value="<%=exp.getId()%>"><%=exp.getSname()%></option> 
							   
							<%}}; %>
							</select>  
							<%--<%session.setAtttribute("CompID",request.getParameter("lstComp"),PortletSession.APPLICATION_SCOPE);--%>
							 </td>
							   <td colspan="2" align="left" valign="middle">Department<div id="lstDept"></div></td>
							  
								   
						  </tr>							
						  
						  <tr>
							  	<td align="left" valign="bottom" colspan="4"><em>&nbsp;Course Information&nbsp;</em></td>						  						  </tr>
								
								<tr>
							  <td align="left" valign="bottom">&nbsp;Department/Institute Issued &nbsp;</td>
							  <td align="left" valign="middle"><select name="lstCompIssued" onchange="selectComp(event,'lstDeptIssued')">
							  	<% String CompidIssued= (String)session.getAttribute("lstCompIssued"); %>
							  	<% List_comp = new ArrayList<CompanyDTO>(); %>							  	
							    <% List_comp= (List<CompanyDTO>)session.getAttribute("CompanyList"); %>
								<% for (int i = 0; i < List_comp.size(); i++){
									CompanyDTO exp = new CompanyDTO();
									exp = List_comp.get(i); 
									if(exp.getId()==Integer.parseInt(CompidIssued)){%>								
							  			<option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
							 	 	<%}else{ %>
							  			<option value="<%=exp.getId()%>"><%=exp.getSname()%></option> 
							  
								<%}}; %>
                                                            </select></td>							
                               
							  <td colspan="2" align="left" valign="middle">Department<div id="lstDeptIssued"></div></td>
							  	
						    </tr>
							<tr>
								<td>&nbsp;Course Name&nbsp;</td>
								<td colspan="3"><div id="lstCourse"></div>
                                 
							  </td>
							</tr>
								
						  <tr>
							  <td align="left" valign="bottom">&nbsp;Grade&nbsp;</td>
							  <td align="left" valign="bottom" colspan="3">								  
								  <select name="lstGrade" onchange="">
								   <% String grade= (String) session.getAttribute("lstGrade"); %>
								   <% List<GradeDTO> List_grade = new ArrayList<GradeDTO>(); %>
								   <% List_grade= (List<GradeDTO>)session.getAttribute("GradeList");%>
								   <% for (int i = 0; i < List_grade.size(); i++){
							  			GradeDTO exp = new GradeDTO();
							  			exp = List_grade.get(i); 
							  			if(exp.getGrade().equals(grade)){ %>
							 				 <option selected value="<%=exp.getGrade()%>"><%=exp.getGrade()%></option> 
							 			 <%}else{%>
							 				  <option value="<%=exp.getGrade()%>"><%=exp.getGrade()%></option>
										<%}
									}; %>
                                  </select></td>
						  </tr>
						  <tr>
							  	<td align="left" valign="bottom" colspan="4"><em>&nbsp;Project Information&nbsp;</em></td>						  						  
						  </tr>
								
								<tr>
							  <td align="left" valign="bottom">&nbsp;Department Issued &nbsp;</td>
							  <td align="left" valign="middle"><select name="lstPrjCom" onchange="selectComp(event,'lstPrjDept')">
							   <% String PrjComid = (String)session.getAttribute("lstPrjCom"); %>
							   <% List_comp= (List<CompanyDTO>)session.getAttribute("CompanyList"); %>
							   <% for (int i = 0; i < List_comp.size(); i++){
								CompanyDTO exp = new CompanyDTO();
								exp = List_comp.get(i); 
									if(exp.getId()==Integer.parseInt(PrjComid)){%>								
								  <option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
								  <%}else{ %>
								  <option value="<%=exp.getId()%>"><%=exp.getSname()%></option> 
								  
								<%}}; %>
                                                            </select></td>							
							  <td colspan="2" align="left" valign="middle">Department <div id="lstPrjDept"></div></td>
								  
						  </tr>
							<tr>
								<td>&nbsp;Project Name &nbsp;</td>
								<td colspan="3"> <div id="lstPrj"></div>
								</td>
							</tr>
						  
						  <tr>
							  <td align="left" valign="bottom" colspan="4"><em>&nbsp;Technology Information&nbsp;</em></td>							  
						  </tr>
						  <tr>
							  <td align="left" valign="bottom">&nbsp;Language&nbsp;</td>
							  <td align="left" valign="bottom"><select name="txtLang" size=3 style="width:180px" ondblclick="removelist(this.form.txtLang.name)"></select></td>
							  <td align="left" valign="bottom">		
							  	  				  
								  <select name="lstLang"
								  		onchange="  this.form.txtExpLang.value='';
								  					this.form.txtExpLang.focus();" >				
														
									<%String lang = (String)session.getAttribute("lstLang");
									  List<LangDTO> list_lang= (List<LangDTO>)session.getAttribute("LangList");
									  for(int i=0;i<list_lang.size();i++){
									  LangDTO exp = new LangDTO();
									  exp=list_lang.get(i);
									  if(exp.getId()==Integer.parseInt(lang)){%>
										  <option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <%}else{ %>
									  	  <option value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <% }};%>
									  
                                    
                            </select> 
								  Months of Experience 
								  <input type="text" name="txtExpLang" /></td>
								<td align="left" valign="bottom">
								   <input name="addLang" type="button" value="Add" 
								  			onclick="outputtolist(this.form.lstLang.name,this.form.txtExpLang.name,this.form.txtLang.name)"/>
								  	<input name="addApp" type="button" value="Remove" 
								  			onclick="removelist(this.form.txtLang.name)"/>	</td>
						  </tr>
						  <tr>
							  <td align="left" valign="bottom">&nbsp;Type of Application&nbsp;</td>
							  <td align="left" valign="bottom"><select name="txtApp" size=3 style="width:180px" ondblclick="removelist(this.form.txtApp.name)"></select></td>
							  <td align="left" valign="bottom">	
							  <select name="lstApp" onchange="  this.form.txtExpApp.value='';
								  								this.form.txtExpApp.focus();" >
							    <%String Appid = (String)session.getAttribute("lstApp");
									  List<AppDTO> list_app= (List<AppDTO>)session.getAttribute("AppList");
									  for(int i=0;i<list_app.size();i++){
									  AppDTO exp = new AppDTO();
									  exp=list_app.get(i);
									  if(exp.getId()==Integer.parseInt(Appid)){%>
										  <option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <%}else{ %>
									  	  <option value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <% }};%>
                                </select>
							  Months of Experience
						    <input name="txtExpApp" type="text" />								</td>
								<td align="left" valign="bottom">
						    <input name="addApp" type="button" value="Add" 
								  			onclick="outputtolist(this.form.lstApp.name,this.form.txtExpApp.name,this.form.txtApp.name)"/>
							<input name="addApp" type="button" value="Remove" 
								  			onclick="removelist(this.form.txtApp.name)"/>	  										</td>
						  </tr>
						  <tr>
							  <td align="left" valign="bottom">&nbsp;Kind of Technology&nbsp;</td>
							  <td align="left" valign="bottom"><select name="txtTech" size=3 style="width:180px" ondblclick="removelist(this.form.txtTech.name)"></select></td>
							  <td align="left" valign="bottom">
							  		<select name="lstTech" onchange="  this.form.txtExpTech.value='';
								  										this.form.txtExpTech.focus();" >
							  		   <%String Techid = (String)session.getAttribute("lstTech");
									  List<TechDTO> list_tech= (List<TechDTO>)session.getAttribute("TechList");
									  for(int i=0;i<list_tech.size();i++){
									  TechDTO exp = new TechDTO();
									  exp=list_tech.get(i);
									  if(exp.getId()==Integer.parseInt(Techid)){%>
										  <option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <%}else{ %>
									  	  <option value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <% }};%>
                                
                              		</select>
							  		Months of Experience
							  		<input name="txtExpTech" type="text" />								</td>
								<td align="left" valign="bottom">
							<input name="addTech" type="button" value="Add" 
								  			onclick="outputtolist(this.form.lstTech.name,this.form.txtExpTech.name,this.form.txtTech.name)"/>								
								  			<input name="addApp" type="button" value="Remove" 
								  			onclick="removelist(this.form.txtTech.name)"/>	</td>
						  </tr>
						  <tr>
							  <td align="left" valign="bottom">&nbsp;Kind of Framework&nbsp;</td>
							  <td align="left" valign="bottom"><select name="txtFrw" size="3" style="width: 180px" ondblclick="removelist(this.form.txtFrw.name)"></select></td>
							  <td align="left" valign="bottom">
							  	  <select name="lstFrw" onchange="  this.form.txtExpFrw.value='';
								  									this.form.txtExpFrw.focus();" >
								     <%String Frwid = (String)session.getAttribute("lstFrw");
									  List<FrwDTO> list_frw= (List<FrwDTO>)session.getAttribute("FrwList");
									  for(int i=0;i<list_frw.size();i++){
									  FrwDTO exp = new FrwDTO();
									  exp=list_frw.get(i);
									  if(exp.getId()==Integer.parseInt(Frwid)){%>
										  <option selected value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <%}else{ %>
									  	  <option value="<%=exp.getId()%>"><%=exp.getSname()%></option>
									  <% }};%>  
								  </select>
							  	  Months of Experience
								  <input name="txtExpFrw" type="text" />								  </td>
								<td align="left" valign="bottom">
							<input name="addFw" type="button" value="Add" 
								  			onclick="outputtolist(this.form.lstFrw.name,this.form.txtExpFrw.name,this.form.txtFrw.name)"/>
								  			<input name="addApp" type="button" value="Remove" 
								  			onclick="removelist(this.form.txtFrw.name)"/>								
								  			</td>
						  </tr>

						  <tr align="left" valign="bottom">
						  	  <td colspan="5"><input type="button" name="btnSearch" value="Search" onclick="Search('<portlet:namespace/>','searchInfoForm')"/><input type="button" name="btnReset" value="Reset" onclick="search_Reload('<portlet:namespace/>','searchInfoForm')"/></td>
						  </tr>
						 <tr>
					<td colspan="4"><h2 class="title">Result List</h2></td>
				</tr>
						  <tr>
						  	<td colspan="4">
						  		<div id="resultTable">
								<table border="1" width="100%">
								<thead>
								<tr>
								<%List<EmployeeDTO> list_result= (List<EmployeeDTO>)session.getAttribute("ResultList");%>
								<% int pagenum=0; 
								if(list_result.size()!=0){ 
								pagenum=(int)(list_result.size()/5);
								int rest=(list_result.size() % 5); 
								  if(rest!=0){
									  pagenum+=1;
								  }
								  }%>
								  
						  	<td colspan="6" align="right"><em><%=list_result.size() %> result(s) found</em></td>
						  </tr>
						  
							<tr>								
								<td align="center" valign="middle">&nbsp;</td>
								<td align="center" valign="middle">Name</td>
								<td align="center" valign="middle">Birthdate</td>
								<td align="center" valign="middle">Address</td>
								<td align="center" valign="middle">Email</td>
								<td align="center" valign="middle">Phone</td>								
							</tr>
						</thead>
						<tfoot>
						  <tr>
						  	<td colspan="6"><%for(int i=0;i<pagenum;i++){%>
						  		<a href="#" onclick="changePage('<%=i %>')"><%=i+1 %></a>
						  		<%} %>
						  	  
						  	</td>
						  </tr>	
						 </tfoot>
						 
							<% for(int i=0;i<list_result.size();i++){ 
							EmployeeDTO exp = list_result.get(i);
							int curPage=(int)((i+1)/5);
							if(i==0){curPage=0;}
							if((((i)%5)==0)||(i==0)){
							if(curPage==0){%>
								<tbody id="<%=curPage %>"> 
								<%}else{ %>
								<tbody id="<%=curPage %>" style="display:none;">
								<%}} %>
							<tr>
							  <td align="center"><input type="checkbox" name="checkbox" value="checkbox" /></td>
							  <td align="left"><a href="#" onclick="gotoempinfo('<portlet:namespace/>','searchInfoForm','<%=exp.getId()%>')"><%=exp.getName() %></a></td>
							  <td align="left" valign="middle"><%=exp.getBirthday() %></td>
  							  <td align="left"><%=exp.getAddress() %></td>
							  <td align="left"><%=exp.getEmail() %></td>
							  <td align="left"><%=exp.getPhone() %></td>
						    </tr>
							<%if((((i-4)%5)==0)||((i+1)==list_result.size())){%></tbody><%} %>
						    <%} %>
										  
					  </table>
					  </div>
							</td>
						  </tr>
				    </table>
				</td>
				</tr>
			</table>			
		</td>
	</tr>
	
</table>


</form>
</body>
